feat(mp4): decode QuickTime audio sample entries .mp3, lpcm, twos, and sowt - #554
Merged
Merged
Conversation
nchitkara-xai
marked this pull request as ready for review
August 18, 2026 16:48
Collaborator
|
@nchitkara-xai Thanks for the PR. Looks good. |
…d sowt These QuickTime sample description names use the standard sound sample description layout, but fell through to UnknownBox, so their channel count, sample size, and sample rate were unreachable without hand parsing. Register them with the audio sample entry decoder and expose them as StsdBox.Mp3 and StsdBox.QtPcm. Since these names decoded as UnknownBox before, a body that does not parse as a sound sample description falls back to UnknownBox instead of failing the file, and the StsdBox.AddChild type assertions for the new names tolerate that fallback instead of panicking on it.
tobbee
force-pushed
the
qt-legacy-audio-entries
branch
from
August 20, 2026 13:16
e9116bb to
1ddbf98
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The QuickTime audio sample entries
.mp3,lpcm,twos, andsowtfallthrough to
UnknownBox, so their sound description fields (channel count,sample size, sample rate, and the version 1/2 extensions — lpcm entries carry
a version 2 description in practice) are unreachable without hand-parsing.
Fix
Register the four names in both dispatch tables so they decode as
AudioSampleEntryBox, reachable asStsdBox.Mp3andStsdBox.QtPcm(oneshared pointer for the three PCM names, like
AvcX/HvcX— checkType()).Two safeguards keep hostile or odd files decodable:
UnknownBoxwith its bytes verbatim, so nothing that decoded before stopsdecoding;
StsdBox.AddChildcases for these names use comma-ok assertions totolerate that fallback, so an stsd containing e.g. a truncated
.mp3entry decodes cleanly instead of panicking.
Note that a
.mp3entry carries no esds; its codec facts live in the sounddescription fields themselves.
Tests
All four names decode with correct fixed fields and round-trip; an lpcm
version 2 description populates
QuickTimeV2; a truncated body falls back toUnknownBoxbyte-verbatim; and an stsd containing that truncated entrydecodes cleanly on both decode paths.
go test ./...,go vet,gofmt,golangci-lintpass.